using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace Eve.API
{
    /// <summary>
    /// Represents the sovereignty properties of a solar system within the Eve universe.
    /// </summary>
    /// <remarks>
    /// The <b>SolarSystem</b> class is returned by the <see cref="Eve.API.EveAPI.GetSovereignty">EveAPI.GetSovereignty</see> method, and
    /// describes the sovereignty properties of a solar system within the Eve universe.
    /// </remarks>
    [Serializable]
    public class SolarSystem
    {
        private NameId solarSystem = new NameId();
        private int allianceId;
        private int constellationSovereignty;
        private int sovereigntyLevel;
        private int factionId;

        /// <summary>
        /// Gets the identifier of the solar system.
        /// </summary>
        /// <value>
        /// The Eve internal identifier of the solar system.
        /// </value>
        public int Id
        {
            get { return solarSystem.Id; }
        }
        /// <summary>
        /// Gets the identifier of the alliance which claims sovereignty in the solar system.
        /// </summary>
        /// <value>
        /// The identifier of the alliance which claims sovereignty in the solar system.
        /// </value>
        public int AllianceId
        {
            get { return allianceId; }
        }
        /// <summary>
        /// </summary>
        public int ConstellationSovereignty
        {
            get { return constellationSovereignty; }
        }
        /// <summary>
        /// </summary>
        public int SovereigntyLevel
        {
            get { return sovereigntyLevel; }
        }
        /// <summary>
        /// Gets the identifier of the faction which claims sovereignty in the solar system.
        /// </summary>
        /// <value>
        /// The Eve internal identifier of the faction which claims sovereignty in the solar system.
        /// </value>
        /// <remarks>
        /// This value can be used to retrieve detailed information about the faction using the <b>Eve.Data</b> class library.
        /// </remarks>
        public int FactionId
        {
            get { return factionId; }
        }
        /// <summary>
        /// Gets the name of the solar system.
        /// </summary>
        /// <value>
        /// The name of the solar system.
        /// </value>
        public string Name
        {
            get { return solarSystem.Name; }
        }

        internal SolarSystem(XmlElement sov)
        {
            solarSystem.Id = int.Parse(sov.Attributes["solarSystemID"].Value);
            allianceId = int.Parse(sov.Attributes["allianceID"].Value);
            constellationSovereignty = int.Parse(sov.Attributes["constellationSovereignty"].Value);
            sovereigntyLevel = int.Parse(sov.Attributes["sovereigntyLevel"].Value);
            factionId = int.Parse(sov.Attributes["factionID"].Value);
            solarSystem.Name = sov.Attributes["solarSystemName"].Value;
        }
    }
}
